<template>
  <section>
    <!--工具条-->
  <!--   <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-input v-model="filters.search" placeholder="鉴赏ID"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="getUser">查询</el-button>
        </el-form-item>
      </el-form>
    </el-col> -->

    <!--列表-->
    <template>
      <el-table :data="users" highlight-current-row v-loading="loading" style="margin-top:20px">
        <el-table-column prop="id" label="ID"  width="120">
        </el-table-column>
        <el-table-column prop="tradeNo" label="订单编号" width="300" >
        </el-table-column>
        <el-table-column prop="userName" label="订单支付者">
        </el-table-column>
        <el-table-column prop="price" label="金额" width="150" >
        </el-table-column>
        <el-table-column prop="description" label="订单描述" width="200" >
        </el-table-column>
        <el-table-column prop="timeEnd"label="支付完成时间" width="200">
        </el-table-column>
        <el-table-column prop="status" label="订单支付状态" width="200">
        </el-table-column>
      </el-table>
    </template>
      <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="20" :total="total" style="float:right;">
      </el-pagination>
      <div class="all">总计<span class="total">{{total}}</span>条记录</div>
    </el-col>
  </section>

</template>
<script>
  import { sendData,cutString  } from "../../api/api";
  export default {
    data() {
      return {
        filters: {
          search: ''
        },
        loading: false,
        users: [
        ],
        total: 0,
        page: 1,
      }
    },
    methods: {
      //获取平台流水记录
      getUser: function () {
        let page=JSON.parse(this.page);
        let params=sendData({url: "pay/list",msg: {pgNo:page,num:20,order:2}})
        this.loading = true;
        this.$http.get(params.baseURL,{params:params.params}).then(res=>{
          var res=cutString(res.bodyText)
          // console.log(res)
          this.total=res.msg.total
          this.users = res.msg.payListRspList
          res.msg.payListRspList.map(function(v,i){
            v.timeEnd=v.timeEnd.slice(0,19)
            v.status==0?v.status="支付失败":v.status="支付成功"
            v.price=(v.price/100).toFixed(2)
          })
          this.loading = false;
          console.log(res)
        })
      },
      // 分页请求
      handleCurrentChange(val) {
        console.log(val)
        this.page = val;
        this.getUser();
      },
    },
    mounted() {
      this.getUser();
    }
  };

</script>

<style scoped>
.all{
  font-size: 16px;
  line-height: 32px;
  color: #666
}
.total{
    padding:0 5px;
    color: #52BAE9;
  }
</style>